#region Header
//=============================================================================
//                          GShield (Game Shield)
//=============================================================================
//
// Original Programmer: Shawn Jackson
// Company: WaveTech Digital Technologies, Inc. (http://www.wtdt.com)
// Copyright: (c) 2006 WaveTech Digital Technologies, Inc. All Rights Reserved.
// Assembly: Library
// Code File Name: Game.cs
// Code File Date: 12/8/2006
//
// Code File Info: Game Object Definiation
//=============================================================================
/*
 * UPDATES
 * -------
 *      ShawnJ 5/4/2007 (0.9.0.x): Refactoring for OSS.
 *			ShawnJ 8/7/2007 (0.9.5.x): Code Commenting.
 */
#endregion Header

#region License
/*
  GShield - Game Shield
  Copyright (C) 2006-2007 WaveTech Digital Technologies, Inc.
                                http://www.wtdt.com

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#endregion License

#region Includes
using System;
using System.Text;
using WaveTech.GShield.Library.Enumerations;
#endregion Includes

namespace WaveTech.GShield.Library.Objects
{
    /*
  /// <summary>
  /// Class defining a Game object
  /// </summary>
	[Serializable]
  public class Game
	{
		#region Private Members
		private int? m_id;
		private string m_name;
		private string m_publisher;
		private string m_content;
		private string m_rating;
		private int? m_ratingType;
		private string m_platforms;
		private string m_fileName;
		private string m_path;
		private string m_internalName;
		private string m_productName;
		private string m_company;
		private string m_directoryName;
		private DateTime? m_dateAdded;
		private bool m_wasChecked;
		private DateTime? m_dateChecked;
		private bool? m_notAGame;
		private string m_hash;
		#endregion Private Members

		#region Constructors
		public Game() { }

    public Game(GameProcess gameProcess, GameRatingDetail ratingDetail, RatingType gameRating, string directoryName, string fileName)
    {
      m_name = gameProcess.Name;
      m_internalName = gameProcess.InternalName;
      m_productName = gameProcess.ProductName;
      m_company = gameProcess.Company;
      m_directoryName = directoryName;
      m_fileName = fileName;
      m_path = gameProcess.FullPath;
      
      
      if (ratingDetail != null)
      {
        m_rating = ratingDetail.Rating;
        m_content = ratingDetail.Content;
        m_platforms = ratingDetail.Platforms;
        m_publisher = ratingDetail.Publisher;
      }
      
      m_ratingType = (int)gameRating;

      if (m_ratingType.HasValue && m_ratingType.Value != (int)Enumerations.RatingType.Unknown)
      {
        m_dateChecked = DateTime.Now;
        m_wasChecked = true;
      }
      
      m_notAGame = false;
      m_dateAdded = DateTime.Now;


    }

    public Game(string name, string internalName, string productName, string company, string fullPath, GameRatingDetail ratingDetail, RatingType gameRating, string directoryName, string fileName)
    {
      m_name = name;
      m_internalName = internalName;
      m_productName = productName;
      m_company = company;
      m_directoryName = directoryName;
      m_fileName = fileName;
      m_path = fullPath;


      if (ratingDetail != null)
      {
        m_rating = ratingDetail.Rating;
        m_content = ratingDetail.Content;
        m_platforms = ratingDetail.Platforms;
        m_publisher = ratingDetail.Publisher;
      }

      m_ratingType = (int)gameRating;

      if (m_ratingType.HasValue && m_ratingType.Value != (int)Enumerations.RatingType.Unknown)
      {
        m_dateChecked = DateTime.Now;
        m_wasChecked = true;
      }

      m_notAGame = false;
      m_dateAdded = DateTime.Now;


    }
    #endregion Constructors

    #region Public Properties
		/// <summary>
		/// Primary Identifier for this game
		/// </summary>
    public int? Id
    {
      get { return m_id; }
      set { m_id = value; }
    }

		/// <summary>
		/// Name of the game
		/// </summary>
    public string Name
    {
      get { return m_name; }
      set { m_name = value; }
    }

		/// <summary>
		/// Publisher of the game
		/// </summary>
    public string Publisher
    {
      get { return m_publisher; }
      set { m_publisher = value; }
    }

		/// <summary>
		/// ESRB content for the game, seperated by commas
		/// </summary>
    public string Content
    {
      get { return m_content; }
      set { m_content = value; }
    }

		/// <summary>
		/// ESRB rating code
		/// </summary>
    public string Rating
    {
      get { return m_rating; }
      set { m_rating = value; }
    }

		/// <summary>
		/// Nullable integer based on the Rating code string
		/// </summary>
    public int? RatingType
    {
      get { return m_ratingType; }
      set { m_ratingType = value; }
    }

		/// <summary>
		/// Platforms for this game, usually Windows PC
		/// </summary>
    public string Platforms
    {
      get { return m_platforms; }
      set { m_platforms = value; }
    }

		/// <summary>
		/// File name of the primary executable or assembly
		/// </summary>
    public string FileName
    {
      get { return m_fileName; }
      set { m_fileName = value; }
    }

		/// <summary>
		/// Full path to the game executable or assembly
		/// </summary>
    public string Path
    {
      get { return m_path; }
      set { m_path = value; }
    }

		/// <summary>
		/// Internal name of the module name from the file metadata
		/// </summary>
    public string InternalName
    {
      get { return m_internalName; }
      set { m_internalName = value; }
    }

		/// <summary>
		/// Product name of the module name from the file metadata
		/// </summary>
    public string ProductName
    {
      get { return m_productName; }
      set { m_productName = value; }
    }

		/// <summary>
		/// Company of the module name from the file metadata
		/// </summary>
    public string Company
    {
      get { return m_company; }
      set { m_company = value; }
    }

		/// <summary>
		/// Name of the directory the primary executable or module is in
		/// </summary>
    public string DirectoryName
    {
      get { return m_directoryName; }
      set { m_directoryName = value; }
    }

		/// <summary>
		/// Date the game was added to the database
		/// </summary>
    public DateTime? DateAdded
    {
      get { return m_dateAdded; }
      set { m_dateAdded = value; }
    }

		/// <summary>
		/// Was this game checked for a rating against the ESRB's website
		/// </summary>
    public bool WasChecked
    {
      get { return m_wasChecked; }
      set { m_wasChecked = value; }
    }

		/// <summary>
		/// Date the game was checked against the ESRB website
		/// </summary>
    public DateTime? DateChecked
    {
      get { return m_dateChecked; }
      set { m_dateChecked = value; }
    }

		/// <summary>
		/// If true this is a directory and not a game
		/// </summary>
    public bool? NotAGame
    {
      get { return m_notAGame; }
      set { m_notAGame = value; }
    }

		/// <summary>
		/// Stored computed hash for this game
		/// </summary>
    public string Hash
    {
      get { return m_hash; }
      set { m_hash = value; }
    }

    #endregion Public Properties

    #region Public Functions
		/// <summary>
		/// Computes the current hash for critical object members
		/// </summary>
		/// <returns>Hash as a string</returns>
    public string ComputeHash()
    {
      StringBuilder newHash = new StringBuilder();

			if (m_name != null)
				newHash.Append(m_name.Trim());

			if (m_publisher != null)
				newHash.Append(m_publisher.Trim());

			if (m_ratingType != null)
				newHash.Append(m_ratingType.ToString().Trim());

			if (m_wasChecked != null)
				newHash.Append(m_wasChecked.ToString().Trim());

			if (m_internalName != null)
				newHash.Append(m_internalName.Trim());

			if (m_productName != null)
				newHash.Append(m_productName.Trim());

			if (m_dateAdded != null)
				newHash.Append(m_dateAdded.Value.ToString().Trim());

			if (m_notAGame != null)
				newHash.Append(m_notAGame.ToString().Trim());
      
      return Common.Hash.ComputeHash(newHash.ToString(), "SHA256", null);
    }

		/// <summary>
		/// Checks to ensure the computed hash matches the current
		/// hash of critical object members.
		/// </summary>
		/// <returns>True if the hashs match, otherwise false.</returns>
    public bool IsHashValid()
    {
			if (m_hash == null)
				return false;

			return Common.Hash.VerifyHash(ComputeHash(), "SHA256", m_hash);
    }
    #endregion Public Functions
  }

    */
}